// 1. 导入所需模块
import Vue from 'vue'
import VueRouter from 'vue-router'
// 导入组件
import MyHome from '@/components/MyHome.vue'
import MyMovie from '@/components/MyMovie.vue'
import MyAbout from '@/components/MyAbout.vue'
import AboutMe from '@/components/AboutMe.vue'
import AboutYou from '@/components/AboutYou.vue'
import SecondMovies from '@/components/SecondMovies.vue'

// 2. 调用 Vue.use() 函数，将 VueRouter 安装为 Vue 的插件
Vue.use(VueRouter)

// 3. 创建路由的实例对象
const router = new VueRouter({
    routes: [
        { path: '/home', component: MyHome },
        { path: '/movie', component: MyMovie,},
        { path: '/second/:id/:name', component: SecondMovies,},
        { path: '/about', component: MyAbout, children: [
            { path: 'you', component: AboutYou },
            { path: 'me', component: AboutMe }
        ]}
    ]
})

// 4. 导出路由的实例对象
export default router